<script setup>
	import { ref } from 'vue'
	import Worktable from './components/Worktable.vue'
	import ServeWorktable from './components/ServeWorktable.vue'
	import { bannerListApi } from '@/apis/index.js'
	import { config } from '@/common/config.js'
	
	const bannerList = ref([])
	const getBannerList = async () => {
		const res = await bannerListApi()
		try{
			bannerList.value = res.rows.map(item => {
				return {
					...item,
					image: config.baseUrl + item.imageUrl
				}
			})
		}catch{}
	}
	getBannerList()
	
	const changeSwiper = index => {
		var url = bannerList.value[index].linkUrl
        var richTextStatus = bannerList.value[index].richTextStatus
        if(!url) return
        if (richTextStatus===0) {
            uni.navigateTo({
                url:`/pages/index/webview?url=${url}`
            })
        } else {
            url = config.staticUrl + url
            uni.navigateTo({
                url:`/pages/index/webview?url=${url}`
            })
        }
	}
</script>
`
<template>
	<div class="page_container">
		<u-swiper height="350" img-mode="aspectFill" @click="changeSwiper" :list="bannerList"></u-swiper>
		<ServeWorktable />
		<Worktable />
	</div>
</template>

<style scoped lang="scss"></style>